package com.vue.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vue.mapper.PayMapper;
import com.vue.pojo.Pay;
import com.vue.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ImPayService extends ServiceImpl<PayMapper ,Pay> implements PayService {
    @Autowired
    private PayMapper payMapper;
    @Override
    public Page<Pay> findll(Integer pagenumber, Integer pagesize, String type) {
        Page<Pay> payPage=new Page<>(pagenumber,pagesize);
        return payMapper.selectPage(payPage,new QueryWrapper<Pay>().eq("type",type));
    }

    @Override
    public int del(Integer id) {
        return payMapper.deleteById(id);
    }

    @Override
    public int add(Pay pay) {
        return payMapper.insert(pay);
    }

    @Override
    public Pay findById(Integer id) {
        return payMapper.selectById(id);
    }

    @Override
    public Pay fingByName(String name) {
        return payMapper.selectOne(new QueryWrapper<Pay>().eq("name",name));

    }
}
